minecraftmodcustomstufffandomcom-20200215-history
Smelting recipes
Smelting recipes are how you tell Minecraft that cooking item 'A' in a furnace produces item 'B'. To add a smelting recipe to the game, you need to add a line to your mod.js file that looks similar to this: mod.addSmeltingRecipe("297 1", 296); This smelting recipe will add the ability to cook wheat directly into bread. This can be a useful recipe if you have tons of coal, but not much wheat yet. Just like in the old CS1 versions, only three values are needed to be changed to get different recipes. The exact layout for adding a vanilla smelting recipe is as follows: mod.addSmeltingRecipe("output quantity", input); Thanks to the new alias feature added in CS2, output and input can be either number values or aliases. Here is the same example, but using aliases instead of id values. mod.addAlias(296, "wheat"); mod.addAlias(297, "bread"); mod.addSmeltingRecipe("bread 1", "wheat"); Notice how much easier it is to read this version of the recipe. This is not the only reason to use aliases in your recipes though. It is currently not possible to specify damage values in a smelting recipe without using aliases. Here is an example of how to add a smelting recipe that uses damage values. mod.addAlias(111, "lilypad"); mod.addAliasWithMetadata(351, 2, "greenDye"); mod.addSmeltingRecipe("greenDye 1", "lilypad"); This recipe will smelt a lily pad into green dye (cactus green). Finally, there is another form for adding smelting recipes. It is as follows: mod.addSmeltingRecipeFor("list", "output quantity", input}; In CS2, list is the equivalent of the usedrecipes attribute from CS1. The addSmeltingRecipe version basically automatically filled in list with "vanilla" to add it to vanilla furnaces. You can substitute this value for whatever you want your furnaces to use. If you want to use a specific recipe list you have to create a tile entity and include usedFuelLists = "list"; ---- Smelting recipes are how you tell Minecraft that cooking item 'A' in a furnace produces item 'B'. To create a smelting recipe, you must add a text file with the file extension '.srecipe' to the 'config/customSmeltingRecipes' folder. This file should contain a single string like so: smeltingRecipes.addRecipe("4 1 1", "vanilla"); This is the smelting recipe for turning cobblestone into smooth stone when smelted in any furnace that supports vanilla smelting recipes. You'll usually only need to change the three numbers within the quotes, though the word can also be changed to alter which furnaces can smelt the item. Here's a breakdown of what each part mean: smeltingRecipes.addRecipe("{input} {output} {quantity produced}", "{furnace used}"); Input is the item Id of the item you put into the furnace, while output is the item Id of the item being created by the process. Quantity produced should be self explanitory. The "furnace used" part is a little trickier. Normally you'll want to add the word "vanilla" here, which means that it can be smelted by the furnace in the vanilla game. If you're creating a custom furnace, however, you may want to change this to something else. For example, if you're creating a freezer, you can change the last parameter to "freezer", and then set the usedrecipes attribute of your 'furnace' container to "freezer" as well. This way the container won't smelt normal items, but will 'freeze' your custom item. You can also add multiple lines to a single '.srecipe' file if you'd like to condence the number of files for a project. Category:Examples Category:Examples (CS1) Category:Examples (CS2) Category:Custom Stuff 2